import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:music_app/controllers/audio_player_controller.dart';
import 'package:music_app/modules/recomment/recomment_day.dart';

// import 'package:music_app/modules/recomment/memory_play_list.dart';
import 'package:music_app/modules/recomment/recomment_rank_list.dart';
import 'package:music_app/modules/recomment/recomment_song_list.dart';
import 'package:music_app/modules/recomment/recomment_songs.dart';
// import 'package:music_app/modules/recomment/week_hot_list.dart';
// import 'package:music_app/modules/recomment/mood_list.dart';
// import 'package:music_app/modules/recomment/broad_cast.dart';
// import 'package:music_app/modules/recomment/hot_program.dart';
import 'package:music_app/widget/fake_search_bar.dart';
import 'package:music_app/widget/my_cached_network_image.dart';
// import 'package:music_app/widget/lazy_load_list_view.dart';

class RecommentView extends StatefulWidget {
  const RecommentView({super.key});

  @override
  State<RecommentView> createState() => _RecommentViewState();
}

class _RecommentViewState extends State<RecommentView> {
  @override
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          onPressed: () {},
          icon: const Icon(
            Icons.mic,
            size: 24,
          ),
        ),
        title: FakeSearchBar(
          hints: const [
            "五月天 你不是真正的快乐",
            "周杰伦 夜曲",
            "Taylor Swift 最新单曲",
          ],
          onTap: () {
            // 跳转搜索页
            Get.toNamed('/search');
          },
          onScan: () {
            // 跳转扫码页
            Get.toNamed('/search');
          },
        ),
        actions: [
          GestureDetector(
            onTap: () {
              Get.toNamed('/my');
            },
            child: Container(
              width: 30,
              height: 30,
              margin: const EdgeInsets.only(left: 12, right: 12),
              child: ClipRRect(
                borderRadius: BorderRadius.circular(16),
                child: const MyCachedNetworkImage(
                  imageUrl:
                      'https://p2.music.126.net/fM7vC38wA8N_EK7zMSHfpw==/109951170529173799.jpg',
                  width: 30,
                  height: 30,
                  x: 120,
                  y: 120,
                ),
              ),
            ),
          ),
        ],
      ),
      body: Padding(
        padding: const EdgeInsets.all(12),
        child: ListView(
          children: [
            const RecommentDay(),
            const RecommentSongs(),
            const RecommentSongList(),
            const RecommentRankList(),
            Obx(() {
              final audioController = Get.find<AudioPlayerController>();

              if (audioController.currentSong.isEmpty) {
                return const SizedBox.shrink();
              }
              return const SizedBox(
                height: 60,
              );
            }),
            // MemoryPlayList(),
            // WeekHotList(),
            // MoodList(),
            // HotProgram(),
            // BroadCast(),
          ],
        ),
      ),
    );
  }
}
